<?php
/**
 * Created by PhpStorm.
 * User: 王飞
 * Date: 2017/8/25
 * Time: 1:18
 */
namespace app\admin\controller\orderactive;

use app\admin\model\StaffCard;
use app\common\controller\Backend;
use app\common\model\Category as CategoryModel;

class Index extends Backend
{
	protected $model = null;
	
	public function _initialize()
	{
		parent::_initialize();
		$statuslist=db('activeStatus')->select();
		$this->view->assign('statuslit',$statuslist);
		$this->model = model('Orderactive');
	}
	
	/**
	 * @param null $id
	 * @return string|\think\response\Json
	 * 展示到店用户列表
	 */
	public function index($id = null)
	{
		//此函数功能是对员工形象照片的一些展示，和管理
		/**
		 * 点击查看个人形象照片，此页面为addtab页面，可以添加修改删除个人形象的照片
		 * step1：读取读取id为x的员工所有的个人形象照片，并加载到html页面中
		 */
		if ($this->request->isAjax())
		{
			list($where, $sort, $order, $offset, $limit) = $this->buildparams();
			$total = $this->model->with('activestatus')->with('active')
				->where($where)
				->order($sort, $order)
				->count();
			$list = $this->model->with('activestatus')->with('active')
				->where($where)
				->order($sort, $order)
				->limit($offset, $limit)
				->select();
			$result = array("total" => $total, "rows" => $list);
			return json($result);
		}
		return $this->view->fetch();
	}
	
}